package com.shop.cereshop.commons.enums.recommend;

import io.swagger.annotations.ApiModel;
import lombok.Getter;

@Getter
@ApiModel(value = "RecommendAtTypeEnum", description = "@他人类型枚举")
public enum RecommendLikeTypeEnum {
    RECOMMEND(1, "动态"),
    COMMENT(2, "评论")
    ;
    RecommendLikeTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private final Integer code;
    private final String msg;

    public static String getMsgByCode(Integer code) {
        for (RecommendLikeTypeEnum value : RecommendLikeTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getMsg();
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (RecommendLikeTypeEnum value : RecommendLikeTypeEnum.values()) {
            if (value.getMsg().equals(msg)) {
                return value.getCode();
            }
        }
        return -1;
    }
}
